function Moneypot(ent, chest)
    if ( SERVER ) && chest == false then
        Cash = ents.Create("prop_physics")
        Cash:SetModel("models/props_junk/PopCan01a.mdl")
        Cash:SetPos(Vector(ent:GetPos().x, ent:GetPos().y, ent:GetPos().z+15))
        Cash:Spawn()
        Cash:SetColor(255, 242, 0, 255)
        Cash:SetMaterial("models/shiny")
        Cash:SetVar("IsCash", true)
        local Amount = math.random(1,2)
        if Amount == 1 then
            Cash = ents.Create("prop_physics")
            Cash:SetModel("models/props_junk/PopCan01a.mdl")
            Cash:SetPos(Vector(ent:GetPos().x, ent:GetPos().y, ent:GetPos().z+15))
            Cash:Spawn()
            Cash:SetColor(255, 242, 0, 255)
            Cash:SetMaterial("models/shiny")
            Cash:SetVar("IsCash", true)
        elseif Amount == 2 then
            Casha = ents.Create("prop_physics")
            Casha:SetModel("models/props_junk/PopCan01a.mdl")
            Casha:SetPos(Vector(ent:GetPos().x, ent:GetPos().y, ent:GetPos().z+20))
            Casha:Spawn()
            Casha:SetColor(255, 242, 0, 255)
            Casha:SetMaterial("models/shiny")
            Casha:SetVar("IsCash", true)
            Cashb = ents.Create("prop_physics")
            Cashb:SetModel("models/props_junk/PopCan01a.mdl")
            Cashb:SetPos(Vector(ent:GetPos().x, ent:GetPos().y, ent:GetPos().z+25))
            Cashb:Spawn()
            Cashb:SetColor(255, 242, 0, 255)
            Cashb:SetMaterial("models/shiny")
            Cashb:SetVar("IsCash", true)
        end
    elseif ( SERVER ) && chest == true then
    
    end
end

function DropPots(victim, killer, weapon)
    --if victim:GetVar("chest", false) then
    Moneypot(victim, false)
    --elseif victim:GetVar("chest", true) then
        ---Moneypot(victim, true)
    --end
end
hook.Add("OnNPCKilled", "Dropcash", DropPots)

function TakeMoney(ply, entity)
    if entity:GetVar("IsCash") == true then
        entity:Remove()
        ply:SetPData("money", ply:GetPData("money", 0) + math.random(5,10) )
        ply:SetNWInt("money", ply:GetPData("money")) 
        print(ply:GetPData("money", 0))
    end
end
hook.Add("PlayerUse", "Takecash", TakeMoney)
    



